package com.lancoo.ccas53.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lancoo.ccas53.entity.Student;
import com.lancoo.ccas53.entity.TeachingClass;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lancoo.ccas53.config.MybatisRedisCache;
import com.lancoo.ccas53.entity.TeachingClassTeacher;
import com.lancoo.ccas53.entity.TeachingClassWeek;
import com.lancoo.ccas53.pojo.dto.ArrangeTeachingClassDto;
import com.lancoo.ccas53.pojo.dto.SyncTeachingClassDto;
import com.lancoo.ccas53.pojo.dto.TeachingClassCourseDto;
import com.lancoo.ccas53.pojo.dto.TeachingClassWeekScheduleDto;
import com.lancoo.ccas53.pojo.vo.GenerateTeachingClassUnitInput;
import com.lancoo.ccas53.pojo.vo.TeachingClassHourVo;
import com.lancoo.ccas53.pojo.vo.TeachingClassSegmentVo;
import com.lancoo.ccas53.pojo.vo.TeachingClassVo;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 教学班 Mapper 接口
 * </p>
 *
 * @author quin.song
 * @since 2024-05-20
 */
@CacheNamespace(implementation = MybatisRedisCache.class, eviction = MybatisRedisCache.class)
public interface TeachingClassMapper extends BaseMapper<TeachingClass> {


    /**
     * 根据课程id获取教学班
     *
     * @param courseId
     * @return
     */
    List<TeachingClassVo> getTeachingClassByCourseId(@Param("courseId") Long courseId);

    /**
     * 获取教学班及授课方式
     * @param page
     * @param taskId
     * @param campusId
     * @param collegeId
     * @param gradeId
     * @param baseMajorId
     * @param uniqueShiftSigns
     * @param keyWord
     * @param teacherId
     * @return
     */
    Page<TeachingClassHourVo> getTeachingClassHourVo(@Param("page") IPage page, @Param("taskId") Integer taskId, @Param("flag") Integer flag, @Param("campusId") Integer campusId,
                                                     @Param("collegeId") String collegeId, @Param("gradeId") String gradeId, @Param("baseMajorId") String baseMajorId,
                                                     @Param("uniqueShiftSigns") List<String> uniqueShiftSigns, @Param("keyWord") String keyWord, @Param("teacherId") Long teacherId);

    /**
     * 获取课程教学班 排课数据
     *
     * @param taskId
     * @param campusId
     * @return
     */
    List<ArrangeTeachingClassDto> getCourseArrangeTeachingClassDto(@Param("taskId") Integer taskId, @Param("campusId") String campusId,
                                                                   @Param("collegeId") String collegeId,@Param("majorProp") Integer majorProp,@Param("teachingClassId") Long teachingClassId);


    List<ArrangeTeachingClassDto> getSubCourseArrangeTeachingClassDto(List<String> subIds);

    /**
     * 根据分班唯一标识获取教学班
     * @param uniqueShiftSign
     * @return
     */
    List<TeachingClass> getTeachingClassByShiftsign(@Param("uniqueShiftSign") String uniqueShiftSign);

    List<GenerateTeachingClassUnitInput> getAllUnArrangeTeachingClass(Integer taskId, int state, String baseCollegeId);
    List<GenerateTeachingClassUnitInput> getUnArrangeTeachingClassWeek(List<Long> tcIds);

    IPage<TeachingClassCourseDto> getCourseTeachingClassForArrange(Page<TeachingClassCourseDto> page, Integer taskId, Integer state);

    List<TeachingClassWeekScheduleDto> getTeachingClassSchedule(Integer taskId, List<Long> classIds);

    List<TeachingClassWeekScheduleDto> getClassByTeacher(Integer taskId, String collegeId, Long teacherId, String keyword);


    List<TeachingClassTeacher> getTeacherTeachingClassByTaskId(List<Integer> taskIds, Long teacherId, String college);

    List<TeachingClassWeekScheduleDto> getClassByRoom(Integer taskId, String collegeId, Long roomId, String keyword);

    List<TeachingClassWeekScheduleDto> getUnRangeByIds(List<Long> ids, String collegeId, int state);

    List<TeachingClassWeekScheduleDto> getClassAndHourByTeacher(Integer taskId, Long teacherId);

    List<TeachingClassWeekScheduleDto> getTeachingClassScheduleTeacher(Integer taskId, List<TeachingClassWeekScheduleDto> teachingClassTeachers);

    List<TeachingClassWeek> selectListByRoomIdHasWeekNum(Integer taskId, Long roomId);

    List<Student> getTeachingClassStudent(Integer taskId, String keyword);

    IPage<TeachingClassSegmentVo> getSegmentTeachingClassForArrange(Page<TeachingClassSegmentVo> page, Integer taskId, String gradeId, String majorId, String type, String keyword, String baseCollegeId);

    List<SyncTeachingClassDto> syncCourseTeachingClassDto(Integer taskId, Integer type);

    List<SyncTeachingClassDto> syncSegmentTeachingClassDto(Integer taskId);

    List<TeachingClass> getTeacherTeachingClassList(Integer taskId);

    List<Long> getAllTeachingClassId(Integer taskId);

    void insertList(@Param("teachingClassList") List<TeachingClass> teachingClassList);

    List<TeachingClass> deleteByCourseIds(@Param("courseIds") List<Long> courseIds);

    List<Long> getTeachingClassIds(Integer taskId);

    List<TeachingClass> exportTeachingClass();

    List<TeachingClass> lockRoundList(Integer taskId);

    void updateLockByTeachingClassIds(List<Long> tcIds, Integer lock, Integer range);

    List<ArrangeTeachingClassDto> getAllTeachingClass(Integer taskId);
    List<ArrangeTeachingClassDto> getAllTeachingClass1(Integer taskId);

    List<String> getSplictTeacherUUid(List<Long> teachingClassIds);

    List<Long> getSplictTeacherTeachingClassByUUid(List<String> uuid);
}
